Skip to content

ci: Resolve most zizmor findings as of zizmor@1.31.1 - #1410

Merged
BurntSushi merged 6 commits into
rust-lang:masterfrom
hashcatHitman:zizmor
Nov 18, 2026
Merged

BurntSushi merged 6 commits into
rust-lang:masterfrom
hashcatHitman:zizmor

Conversation

@hashcatHitman

Copy link
Copy Markdown
Member

In pursuit of getting more zizmor lints enforced across rust-lang repos through crabwatch, this PR fixes most zizmor findings as of zizmor@1.31.1, using the auditor persona. The lints that actually fired per-persona level are:

regular persona findings:

pedantic persona findings:

auditor persona findings:

  • Everything from pedantic
  • Not fixed in this PR:
    • None

The hash pin format is supported by tools like Dependabot and Renovate, which can update the pinned hashes and their associated comments. If you'd like help setting either of those up, let me know which you prefer, and if you'd like it in this PR or a new one. By default, I'd assume to set it up to only update GitHub Actions.

@BurntSushi BurntSushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm overall in favor of this. How did you generate the hashes for this? I guess it probably makes sense to set up dependenabot for this, since it seems annoying to do so otherwise.

Comment thread .github/workflows/ci.yml
run: cross test --verbose -p regex-lite --lib --target ${{ matrix.target }}
run: cross test --verbose -p regex-lite --lib --target ${TARGET}
env:
TARGET: ${{ matrix.target }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to the template-injection audit of zizmor. Template expansion can be abused or misused in some cases. That obviously isn't the case here, but because crabwatch uses the pedantic persona, zizmor flags all template expansion in code contexts, which it considers code smells.

It can be made less repetitive if we move the definition of the TARGET environment variable to the job level, if that's bothering you.

Comment thread .github/workflows/ci.yml Outdated
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@master
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update these actions/checkout dependencies to the latest version?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@hashcatHitman

Copy link
Copy Markdown
Member Author

I'm overall in favor of this. How did you generate the hashes for this? I guess it probably makes sense to set up dependenabot for this, since it seems annoying to do so otherwise.

zizmor provides automatic fixes for the unpinned-uses lint, so I will usually disable every lint other than unpinned-uses in a locally defined config file and run:

zizmor --gh-token "$(gh auth token)" --config ./zizmor.yml --persona=auditor . --fix=all

I commit each unique action/version separately after checking the releases on the project GitHub repository to make sure I have the correct version and the correct hash.

The hashes are just commits corresponding to a specific release, in case that wasn't clear. It is certainly a bit tedious. zizmor has only ever gotten the fix wrong once (as long as I've been using it), due to a particular action having a stale tag (see: #t-infra/crabwatch > rust-playground and generated workflows @ 💬), but I always check to be sure.

See: https://github.com/actions/checkout/releases/tag/v5.1.0

This is the same version we're already implicitly using.

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Because `dtolnay/rust-toolchain` doesn't provide proper releases, it is
impossible to pin correctly. It also isn't really necessary, since all
standard GitHub Actions runners have `rustup` preinstalled.

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
@BurntSushi

Copy link
Copy Markdown
Member

Hmmm yeah that seems like a pain. Definitely would appreciate having Dependenabot setup. If you can do that in this PR, that would be great! And yeah, only do it for GitHub Actions.

See: https://github.com/actions/checkout/releases/tag/v7.0.1

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
@hashcatHitman

Copy link
Copy Markdown
Member Author

Hmmm yeah that seems like a pain. Definitely would appreciate having Dependenabot setup. If you can do that in this PR, that would be great! And yeah, only do it for GitHub Actions.

Do you have a preferred:
Timezone (e.g. Etc/UTC)
Time (e.g. 23:00)
Frequency ("monthly", "weekly", "daily", etc.)

@BurntSushi

Copy link
Copy Markdown
Member

How about 06:00 UTC weekly?

Signed-off-by: hashcatHitman <155700084+hashcatHitman@users.noreply.github.com>
@hashcatHitman hashcatHitman moved this from zizmor PR opened to zizmor PR in review in t-crabwatch policy expansion Nov 18, 2026
@hashcatHitman

Copy link
Copy Markdown
Member Author

Let me know if you have any other questions or requests, or if you'd like me to rebase onto the latest master to deal with the failing ci/docsrs job.

@BurntSushi BurntSushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you so much!

@BurntSushi

Copy link
Copy Markdown
Member

Do I have to do anything else to make Dependabot work? Or is it automatic?

@BurntSushi
BurntSushi merged commit 6d6400a into rust-lang:master Nov 18, 2026
19 of 20 checks passed
@hashcatHitman

Copy link
Copy Markdown
Member Author

Do I have to do anything else to make Dependabot work? Or is it automatic?

I believe it should just work once the PR is merged. (Looks like it did, see: https://github.com/rust-lang/regex/actions/workflows/dependabot/dependabot-updates)

@hashcatHitman hashcatHitman moved this from zizmor PR in review to Needs Policy Update in t-crabwatch policy expansion Nov 18, 2026
@hashcatHitman
hashcatHitman deleted the zizmor branch November 18, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Policy Update

Development

Successfully merging this pull request may close these issues.

2 participants